package com.buba.mapper;



import entity.*;
import entity.VO.DailyRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import result.CommonResult;

import java.util.List;

/**
 * LC: 2022-11-16 10:16
 */
@Mapper
public interface DailyRecordMapper {


    /**
     * 根据id查询日记
     * @param id
     * @return
     */
    List<DailyRecordEntity> getDailyRecordById(@Param("id") Integer id,@Param("userId")Integer userId);

    /**
     * 新增浏览量
     * @param dailyRecordEntity
     * @return
     */
    Integer editDailyRecordBrowse(DailyRecordEntity dailyRecordEntity);

    /**
     * 新增评论
     * @param commentEntiry
     * @return
     */
    int saveComment(CommentEntiry commentEntiry);

    /**
     * 根据id查询评论
     * @param id
     * @return
     */
    List<CommentEntiry> getCommentById(@Param("id")Integer id, @Param("commentDictionaries")String commentDictionaries,@Param("userId")Integer userId);

    /**
     * 根据id查询评论数量
     * @param id
     * @return
     */
    String getCommentNum(@Param("id") Integer id, @Param("commentDictionaries") String commentDictionaries);

    /**
     * 新增评论数量
     * @param dailyRecordEntity
     * @return
     */
    int updateDiaryRecordNumber(DailyRecordEntity dailyRecordEntity);

    /**
     * 根据id查询日记
     * @param commentDiaryRecordId
     * @return
     */
    DailyRecordEntity getCommentByIds(Integer commentDiaryRecordId);

    /**
     * 查询图片
     * @param diaryRecordFileId
     * @return
     */
    String selectUrl(String diaryRecordFileId);

    /**
     * 根据id查询日记本图片
     * @param id
     * @return
     */
    List<DiaryEntity> getDailyById(Integer id);

    /**
     * 根据id查询日记本用户
     * @param id
     * @return
     */
    List<DiaryEntity> getdiaryUser(Integer id);

    /**
     * 点赞
     * @param
     * @return
     */
    int getKudosNum(KudosEntity kudosEntity);

    /**
     * 查询是否点赞
     * @param id
     * @param kudosDictionaries
     * @param kudosUserId
     * @return
     */
    List<KudosEntity> getKudosById(@Param("id") Integer id,@Param("kudosDictionaries")  Integer kudosDictionaries,@Param("kudosUserId") Integer kudosUserId);

    /**
     * 修改点赞+1
     * @param dailyRecordEntity
     * @return
     */
    int updateKudosNum(DailyRecordEntity dailyRecordEntity);
    /**
     * 修改点赞
     * @param kudosEntity
     * @return
     */
    int updateKudos(KudosEntity kudosEntity);

    /**
     * 查询没点赞
     * @param id
     * @param kudosDictionaries
     * @param kudosUserId
     * @return
     */
    List<KudosEntity> getKudosByIds(@Param("id")Integer id, @Param("kudosDictionaries")Integer kudosDictionaries,@Param("kudosUserId") Integer kudosUserId);

    /**
     * 日记本详情轮播图片
     * @param id
     * @return
     */
    List<DailyRecordEntity> getDailyRecordFileById(Integer id);

    /**
     * 取消点赞
     * @param commentEntiry
     * @return
     */
    int updateCommentNum(CommentEntiry commentEntiry);

    /**
     * 查询评论点赞
     * @param kudosWholeId
     * @return
     */
    CommentEntiry getCommentByIdNum(Integer kudosWholeId);

    /**
     * 根据id查询日记评论、点赞
     * @param id
     * @return
     */
    DailyRecordEntity getDailyRecordIdOne(@Param("id") Integer id);

    /**
     * 查询关注是否关注
     * @param userId
     * @param id
     * @return
     */
    List<FollowUserEntiry> getFollowUserEntiry(@Param("userId")Integer userId,@Param("id")Integer id);

    /**
     * 取消关注
     * @param userId
     * @param id
     * @return
     */
    Integer delectFollowUserEntiry(@Param("userId")Integer userId, @Param("id")Integer id);

    /**
     * 新增关注
     * @param followUserEntiry
     * @return
     */
    int saveFollowUserId(FollowUserEntiry followUserEntiry);

    /**
     * 查询关注是否取关
     * @param userId
     * @param id
     * @return
     */
    List<FollowUserEntiry> getFollowUserEntiry1(@Param("userId")Integer userId,@Param("id")Integer id);

    /**
     * 添加取关的关注
     * @param userId
     * @param id
     * @return
     */
    Integer delectFollowUserEntiry1(@Param("userId")Integer userId, @Param("id")Integer id);

    /**
     * 查询关注
     * @param id
     * @return
     */
    List<FollowUserEntiry> getFollowUserEntiry3(@Param("userId")Integer userId, @Param("id")Integer id);

//    List<CollectionEntiry> getCollection(@Param("id")Integer id,@Param("collectionDictionaries") Integer collectionDictionaries,@Param("collectionUserId") Integer collectionUserId);

//    int updateCollection(CollectionEntiry collectionEntiry);
//
//    DailyRecordEntity getCollectionByIds(Integer collectionWholeId);
//
//    int updateCollectionNum(DailyRecordEntity dailyRecordEntity);

    /**
     * 全查日记
     * @return
     */
    List<DiaryEntity> getDailyRecordRj();
    /*
    * @param id
    * @return java.util.List<entity.DiaryEntity>
    * @author kdj
    * @describe:根据用户id找到发布的日记
    * @date 2023/3/7 9:00
    */
    List<DailyRecordVO> getDailyRecordByUserId(int id);



}
